<template>
	<view class="listDetails-content">
		
		<image :src="newInfo.img_url" class="details-video"></image>
		<view class="details-title text_black">
			{{newInfo.title}}
		</view>
		<view class="details-tips text_black" v-html="newInfo.content">
			<!-- 课程由奥北体能联合北京体育大学体能训练学院编写，如果您（学校）有意向与奥北体能合作，请联系
			邮箱：aobeitineng@163.com       手机：13581796430 -->
		</view>
		<video v-if="newInfo.video_url" :src="newInfo.video_url" class="details-video"></video>
	</view>
</template>

<script>
	import {getActivityDetail} from "../../static/js/api/plan.js";
	export default{
		data(){
			return{
				newInfo:{},
			}
		},
		onLoad(option) {
			// console.log(option)
			if(option.activity_id){
				this.getActivityInfo(option.activity_id)
			}else{
				if(option.newInfo){
					this.newInfo = JSON.parse(option.newInfo)
					for(let i=0;i<this.newInfo.content.length;i++){
						if(this.newInfo.content[i]=='!'){
							this.newInfo.content=this.newInfo.content.replace('!','&')
						}
					}
				}
			}
			
		},
		methods:{
			getActivityInfo(id){
				getActivityDetail({
					activity_id:id,
				}).then(res=>{
					console.log(res.activity)
					this.newInfo = {
						img_url:res.activity.activity_banner,
						title:res.activity.activity_name,
						content:res.activity.activity_content,
						video_url:res.activity.video_url,
						activity_id:res.activity.id
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./index.scss");
	.listDetails-content{
		width: 100%;
		min-height: 100vh;
		background-color: #fff;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}
	.details-image{
		width: 100%;
		height:300rpx;
	}
	.details-video{
		width: 100%;
		height:420rpx;
	}
	.details-title{
		font-size: 32rpx;
		font-weight: bold;
		margin-left: 30rpx;
		margin-top: 50rpx;
	}
	.details-tips{
		margin:20rpx 30rpx;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 56rpx;
		overflow-x: scroll;
	}
	.text_opblack{
		color: $uni-text-color-opblack;
	}
	.text_black{
		color: $uni-text-color-black;
	}
</style>